<?php
/**
 *	FILENAME: 		/libraries/functions.php
 *	DESCRIPTION:	This library defines commonly used functions for the MyNova Mobile backend and administrative interfaces.
 *	AUTHOR:			Casey Burkhardt
 *	VERSION:		1.0.0
 *	LAST MODIFIED:	12/30/2009
 **/
require_once($_SERVER['DOCUMENT_ROOT'] . "/config/environment.php");

/**
 *	DESCRIPTION:	Sets the correct timezone until execution completes in the current file
 **/
function setTimezone() {
    date_default_timezone_set('America/New_York');
}

/**
 *	DESCRIPTION:	Enforces an SSL connection for backend queries based on the environment type.
 **/
function enforceSSL() {
    if (SSLIsRequired()) {
        if ($_SERVER['HTTPS'] != 'on') {
            $url = "https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
            header("Location: " . $url);
            die();
        }
    }
}
?>